package com.info.zhiduoduo.repository.mapper.crowdsource;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.crowdsource.CrowdsourceFile;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 众包自然人文件 Mapper 接口
 * </p>
 *
 * @author cuichenglong
 * @since 2020-08-19
 */
public interface CrowdsourceFileMapper extends BaseMapper<CrowdsourceFile> {

	@Delete(" DELETE FROM zdd_crowdsource_file WHERE crowdsourceid = #{crowdsourceid} AND file_type = #{file_type}")
	int delFileByIdAndType(int crowdsourceid, int file_type);


	/**
	 * 查询项目绑定的自然人信息
	 * @param projectid
	 * @return
	 */
	@Select(" SELECT ca.* " +
			" FROM zdd_crowdsource_file zcf " +
			" WHERE zcf.crowdsourceid = #{projectid} AND zcf.file_type = #{projectid} ")
	CrowdsourceFile queryCrowdsourceInfo(Integer projectid);

}
